Skip to content

br3eze-code/AgentOS

Repository files navigation

 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•β•   β•šβ•β•    β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•

Network Intelligence Platform β€” v2026.5.2
AI-powered MikroTik management via Telegram, WhatsApp & CLI

Version MikroTik AI License Node Stars

Docs Β· Quick Start Β· CLI Reference Β· Architecture Β· Contributing


The Problem AgentOS Solves

Managing community WiFi infrastructure across multiple MikroTik nodes is painful. WinBox requires a desktop. RouterOS CLI requires memorizing commands. Hotspot billing requires manual voucher generation. Payment collection is disconnected from provisioning.

AgentOS collapses this into one intelligent agent you control from Telegram.

Before AgentOS:                    After AgentOS:
─────────────────                  ──────────────
Open WinBox          ──┐           Send "kick john"
Navigate menus         β”‚    β†’      βœ… Done in 2 seconds
Find user              β”‚
Right-click β†’ Kick   β”€β”€β”˜

Features

πŸ€– AI Coordinator

  • Natural language router management via Gemini 2.5 Flash
  • ReAct reasoning engine with 5-turn depth
  • Context-aware command suggestions and error recovery
  • AgentMemory for persistent session state

πŸ’¬ Multi-Channel Control

Channel Status Notes
Telegram Bot βœ… Production Inline keyboards, button menus
WhatsApp βœ… Production Baileys-powered, no Meta API needed
WebSocket CLI βœ… Production Browser terminal experience
REST API βœ… Production Programmatic/webhook access
RouterOS Native βœ… Production On-device Sentinel agent (.rsc)

🎫 Voucher & Billing System

  • Automated WiFi voucher generation (1Day/1GB Β· 7Day/7GB Β· 30Day/30GB)
  • Mastercard Account-to-Account (A2A) payment integration via OAuth 1.0a RSA-SHA256
  • QR code generation for voucher redemption
  • Wallet-based voucher storage with Firebase sync
  • Dual-limit expiry: time-based OR data quota (limit-bytes-total), whichever comes first

🌐 Network Management

  • Multi-router mesh β€” manage multiple MikroTik nodes from one gateway
  • Real-time DHCP/hotspot user monitoring
  • Firewall rule management
  • Ping, traceroute, bandwidth stats
  • Automated alerts via Telegram on threshold breach

πŸ”’ Security

  • CVE-2026-1526 patched
  • Command allowlist (no arbitrary RCE via Telegram)
  • HTTPS certificate validation on all outbound calls
  • Tiered permission policy (admin / operator / readonly)
  • Rate limiting + Joi input validation on all REST endpoints
  • Audit trail for all router operations

Quick Start

Prerequisites

  • Node.js 20+ (ESM)
  • MikroTik RouterOS 7.x
  • Telegram Bot Token (from @BotFather)
  • Google Gemini API Key
  • Firebase project (or use local JSON fallback)

Installation

# Clone
git clone https://github.com/br3eze-code/br3eze-code.git
cd br3eze-code

# Install dependencies
npm install

# Interactive setup wizard
npm run onboard

# Or manual config
cp .env.example .env
nano .env

Environment Variables

# MikroTik
MIKROTIK_HOST=192.168.88.1
MIKROTIK_USER=admin
MIKROTIK_PASS=your_password
MIKROTIK_PORT=8728

# Telegram
TELEGRAM_TOKEN=your_bot_token
TELEGRAM_ADMIN_CHAT_ID=your_chat_id

# AI
GEMINI_API_KEY=your_gemini_key

# Payments (Mastercard A2A)
MC_CONSUMER_KEY=your_key
MC_PRIVATE_KEY_PATH=./certs/sandbox.p12

# Database
FIREBASE_PROJECT_ID=your_project
# Or leave blank for local JSON fallback

Running

# Foreground (development)
npm start

# Daemon mode (production)
agentos gateway --daemon

# Health check
agentos doctor

# RouterOS Sentinel (deploy to router)
# Upload agentos-sentinel.rsc to your MikroTik
# /import file-name=agentos-sentinel.rsc

CLI Reference

agentos
β”œβ”€β”€ onboard                   Interactive setup wizard
β”œβ”€β”€ gateway                   WebSocket + Telegram gateway
β”‚   β”œβ”€β”€ --daemon              Run as background service
β”‚   β”œβ”€β”€ --force               Kill existing process first
β”‚   └── gateway:stop          Graceful shutdown
β”œβ”€β”€ status (s)                System overview
β”œβ”€β”€ doctor [--fix]            Health check + auto-repair
β”‚
β”œβ”€β”€ network (net)
β”‚   β”œβ”€β”€ ping <host>           ICMP ping via router
β”‚   β”œβ”€β”€ scan                  DHCP lease scan
β”‚   β”œβ”€β”€ firewall              List firewall rules
β”‚   β”œβ”€β”€ block <ip|mac>        Add drop rule
β”‚   └── unblock <ip|mac>      Remove drop rule
β”‚
β”œβ”€β”€ users (user)
β”‚   β”œβ”€β”€ list [--all]          Active / all hotspot users
β”‚   β”œβ”€β”€ kick <username>       Disconnect user
β”‚   β”œβ”€β”€ add <username>        Create hotspot user
β”‚   β”œβ”€β”€ remove <username>     Delete user
β”‚   └── status <username>     Check online + usage
β”‚
β”œβ”€β”€ voucher (v)
β”‚   β”œβ”€β”€ create [plan]         Generate voucher (1Day|7Day|30Day)
β”‚   β”œβ”€β”€ list                  Recent vouchers
β”‚   β”œβ”€β”€ revoke <code>         Delete unused voucher
β”‚   └── stats                 Revenue + usage stats
β”‚
└── config
    β”œβ”€β”€ get <path>            Read config value
    β”œβ”€β”€ set <path> <value>    Write config value
    β”œβ”€β”€ edit                  Open in $EDITOR
    └── show                  Display full config

Telegram Commands

/start      Authenticate and show menu
/status     Router status overview
/users      Active user list with kick buttons
/kick       Kick a user by name
/voucher    Create voucher with plan selector
/stats      Network + billing stats
/ping       Ping a host
/firewall   Show firewall rules
/help       Full command list

Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         Inbound Channels          β”‚
                    β”‚  Telegram β”‚ WhatsApp β”‚ REST β”‚ WS  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚           AgentOS Core            β”‚
                    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                    β”‚  β”‚     AskEngine (ReAct Loop)   β”‚ β”‚
                    β”‚  β”‚     Gemini 2.5 Flash Β· 5T    β”‚ β”‚
                    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                    β”‚  β”‚  AgentMemory β”‚ NodeRegistry  β”‚  β”‚
                    β”‚  β”‚  SkillRegistry β”‚ HookRegistryβ”‚  β”‚
                    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                      β”‚                       β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   MikroTik Manager  β”‚  β”‚    Database    β”‚  β”‚  Payment Gateway  β”‚
   β”‚  routeros-client    β”‚  β”‚  Firebase /    β”‚  β”‚  Mastercard A2A   β”‚
   β”‚  RouterOS API v7    β”‚  β”‚  Local JSON    β”‚  β”‚  OAuth 1.0a RSA   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                     β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   MikroTik Router   β”‚  β”‚   Firestore    β”‚
   β”‚   192.168.88.1      β”‚  β”‚   Collections  β”‚
   β”‚   + Sentinel .rsc   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Subsystems

Module File Role
Core Engine agentos.mjs Entry point, boot sequence
Gateway server/gateway.js WebSocket + HTTP server
MikroTik Manager src/core/mikrotik.js RouterOS API adapter
AI Engine agents/ask-engine.js Gemini ReAct loop
Billing services/billing.js Voucher + payment flow
Sentinel agentos-sentinel.rsc On-router native agent
CLI bin/agentos.js Commander.js entry

Billing Plans

Plan Duration Data Quota Expires On
1Day 24 hours 10 GB Time OR quota (first)
7Day 7 days 21 GB Time OR quota (first)
30Day 30 days 60 GB Time OR quota (first)

Payment flow: Mastercard A2A β†’ Firebase β†’ Voucher Generation β†’ MikroTik Hotspot User


Tech Stack

Layer Technology
Runtime Node.js 20 ESM
Router API MikroTik RouterOS Client v7
AI Engine Google Gemini 2.5 Flash
Messaging node-telegram-bot-api + Baileys (WhatsApp)
Payments Mastercard A2A Β· OAuth 1.0a RSA-SHA256
Database Firebase Firestore / Local JSON
Gateway WebSocket (ws) + Express
CLI Commander.js
Mobile Apache Cordova (Android/iOS/PWA)
Security Helmet Β· Rate-limit Β· Joi
Logging Winston

Deployment

Docker

docker compose up -d

Podman

cp agentos.podman.env .env
podman play kube agentos.yaml

Manual (Linux systemd)

./install.sh
systemctl enable agentos
systemctl start agentos

RouterOS Sentinel

# Upload via WinBox Files or SCP, then:
/import file-name=agentos-sentinel.rsc
# Verify
/system/scheduler print

Repository Structure

agentos/
β”œβ”€β”€ agentos.mjs              Main entry (ESM)
β”œβ”€β”€ agentos-sentinel.rsc     RouterOS native agent
β”œβ”€β”€ agentos-sentinel.rsc                RouterOS bootstrap scripts
β”œβ”€β”€ bin/agentos.js           CLI entry point
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ mikrotik.js      RouterOS manager
β”‚   β”‚   β”œβ”€β”€ gateway.js       WebSocket server
β”‚   β”‚   β”œβ”€β”€ database.js      Firebase/local DB
β”‚   β”‚   └── logger.js        Winston logger
β”‚   └── cli/
β”‚       β”œβ”€β”€ program.js       Commander setup
β”‚       └── commands/        CLI subcommands
β”œβ”€β”€ agents/                  AI agent modules
β”œβ”€β”€ services/                Billing, voucher, payment
β”œβ”€β”€ adapters/                Channel adapters (TG, WA)
β”œβ”€β”€ skills/                  Agent skill definitions
β”œβ”€β”€ workflows/               Automation workflows
β”œβ”€β”€ apps/shared/AgentOSkit/  Shared SDK
β”œβ”€β”€ custom-plugins/          Cordova plugin: aicore
β”œβ”€β”€ vscode-extension/        VS Code extension
β”œβ”€β”€ www/                     Web UI (cyberpunk portal)
β”œβ”€β”€ docs/                    Documentation
β”œβ”€β”€ tests/                   Test suites
└── scripts/                 Deployment scripts

Contributing

See CONTRIBUTING.md for full guidelines.

Quick ways to contribute:


License

Apache 2.0 Β© 2026 Brighton Mzacana Β· br3eze.africa


Built for Africa's community networks Β· Powered by AI Β· Controlled via Telegram

About

AgentOS πŸ™ is a lightweight, single-file implementation that provides a robust foundation for building autonomous AI agents. It implements the core concepts outlined in Karpathy's Agent OS architecture while maintaining simplicity and extensibility.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors